package ylyhappy.cn.ideavim.ui;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;

import com.google.android.material.navigation.NavigationView;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;

import ylyhappy.cn.ideavim.R;
import ylyhappy.cn.ideavim.databinding.ActivityConfigPreviewBinding;
import ylyhappy.cn.ideavim.databinding.DrawerLayoutBinding;

public class ConfigPreviewActivity extends AppCompatActivity {

    private AppBarConfiguration appBarConfiguration;
    private ActivityConfigPreviewBinding binding;
    private DrawerLayoutBinding drawerLayoutBinding;
    final private ConfigModalFormDialog configModalFormDialog = new ConfigModalFormDialog(this);
    private TextInputLayout search_text;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        drawerLayoutBinding = DrawerLayoutBinding.inflate(getLayoutInflater());
        binding = ActivityConfigPreviewBinding.inflate(getLayoutInflater());
        setSupportActionBar(drawerLayoutBinding.appbar);
        setContentView(binding.getRoot());
        NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_config_preview);
        navController.navigate(R.id.searchListFragment);
        appBarConfiguration = new AppBarConfiguration.Builder(navController.getGraph()).build();
        NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);

        NavigationView navigationView = findViewById(R.id.nv_main_navigation);
        NavigationUtils.initMenus(navigationView, navController, configModalFormDialog.buildDialog());

        // save search search_text, search_button

    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        binding = null;
        drawerLayoutBinding = null;
    }

    @Override
    public boolean onSupportNavigateUp() {
        NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_content_config_preview);
        return NavigationUI.navigateUp(navController, appBarConfiguration)
                || super.onSupportNavigateUp();
    }


}